
package es.udc.emarketapp.http.controller.actions.categories;

import es.udc.emarketapp.emarket.model.category.vo.CategoryVO;
import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

import es.udc.emarketapp.emarket.model.countryFacade.CountryFacade;
import es.udc.emarketapp.emarket.model.country.vo.CountryVO;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.struts.action.DefaultAction;
import java.util.ArrayList;



public class PreCategoriesTreeAction extends DefaultAction {

    /* forward name="success" path="" */
    private final static String SUCCESS = "success";
    private final static String FAILURE = "failure";


    public ActionForward doExecute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException, InternalErrorException {

           // List<CategoryVO> currentCategories = new ArrayList<CategoryVO>();

        
            List<String> currentCategories = new ArrayList<String>();
            if(request.getAttribute("currentCategories") != null){
               currentCategories = (List<String>) request.getAttribute("currentCategories");
            }
            
            request.setAttribute("currentCategories", currentCategories);

            return mapping.findForward(SUCCESS);

    }
}
